/**
 * 
 */
package org.mspring.mlog.api.spider.service.impl;

import java.util.List;

import org.mspring.mlog.api.spider.entity.Rule;
import org.mspring.mlog.api.spider.service.SpiderRuleService;
import org.mspring.platform.dao.hibernate.GenericDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 
 * @author Gao Youbo
 * @since 2013-3-8
 */
@Service
@Transactional
public class SpiderRuleServiceImpl extends GenericDao<Rule, Long> implements SpiderRuleService {

    @Override
    public Rule createRule(Rule rule) {
        // TODO Auto-generated method stub
        rule.setEnabled(true);
        return save(rule);
    }

    @Override
    public List<Rule> findAllEnabledRules() {
        // TODO Auto-generated method stub
        return list("select rule from Rule rule where rule.enabled = true");
    }

}
